<!--
<template>
  &lt;!&ndash; 添加或修改项目研发经费对话框 &ndash;&gt;
  <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body :close-on-click-modal="false" v-dialogDrag>
    <el-form ref="form" :model="form" :rules="rules" label-width="120px">
      <el-tabs v-model="activeName" class="detail-tab" type="card">
        <el-tab-pane label="基本信息" name="first">
          <el-row :gutter="20">
            &lt;!&ndash;<el-col :span="12">
              <el-form-item label="项目id" prop="projectId">
                <el-input v-model="form.projectId" placeholder="请输入项目id"/>
              </el-form-item>
            </el-col>&ndash;&gt;
            <el-col :span="24">
              <el-form-item label="项目名称" prop="projectName">
                <el-input v-model="form.projectName" placeholder="请输入项目名称" disabled/>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="费用条目" prop="feeType">
                <el-select v-model="form.feeType" placeholder="请选择费用条目" clearable style="width: 300px">
                  <el-option v-for="dict in dict.type.fee_type"
                             :key="dict.value" :label="dict.label" :value="dict.value"/>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="费用发生日期" prop="feeDate">
                <el-date-picker clearable
                                v-model="form.feeDate"
                                type="date"
                                value-format="yyyy-MM-dd"
                                placeholder="请选择费用发生日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="费用金额" prop="feeMoney">
                <el-input-number :precision="2" v-model="form.feeMoney" placeholder="请输入费用金额"/>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="费用说明" prop="infomation">
                <el-input v-model="form.infomation" type="textarea" placeholder="请输入内容"/>
              </el-form-item>
            </el-col>
          </el-row>
        </el-tab-pane>
      </el-tabs>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="cancel">取 消</el-button>
    </div>
  </el-dialog>
</template>

<script>
    import {addAction, getById, updateAction} from '@/api/manage'

    export default {
        name: "ProjectFeeInfoForm",
        dicts:['fee_type'],
        data() {
            return {
                // 遮罩层
                loading: true,
                activeName: "first",
                // 弹出层标题
                title: "",
                // 是否显示弹出层
                open: false,
                // 表单参数
                form: {},
                // 表单校验
                rules: {},
                url: {
                    getById: '/projectFeeInfo/projectFeeInfo/',
                    add: '/projectFeeInfo/projectFeeInfo/add',
                    edit: '/projectFeeInfo/projectFeeInfo/edit',
                },
            };
        },
        created() {

        },
        methods: {
            handleAddNew(data) {
                let that = this;
                that.reset();
                that.open = true;
                that.form.projectId = data.projectId;
                that.form.projectName = data.projectName;
                that.form.type = data.type;
                that.title = "添加项目研发经费";
            },
            // 取消按钮
            cancel() {
                this.open = false;
                this.reset();
            },
            // 表单重置
            reset() {
                this.form = {
                    id: null,
                    delFlag: null,
                    createBy: null,
                    createTime: null,
                    updateBy: null,
                    updateTime: null,
                    remark: null,
                    feeType: null,
                    feeDate: null,
                    feeMoney: null,
                    infomation: null,
                    projectId: null,
                    projectName: null
                };
                this.resetForm("form");
            },
            /** 新增按钮操作 */
            handleAdd() {
                this.reset();
                this.open = true;
                this.title = "添加项目研发经费";
            },
            /** 修改按钮操作 */
            handleUpdate(row) {
                this.reset();
                const id = row.id || this.ids;
                getById(this.url.getById, id).then(response => {
                    this.form = response.data;
                    this.open = true;
                    this.title = "修改项目研发经费";
                });
            },
            /** 提交按钮 */
            submitForm() {
                this.$refs["form"].validate(valid => {
                    if (valid) {
                        if (this.form.id != null) {
                            updateAction(this.url.edit, this.form).then(response => {
                                this.$modal.msgSuccess("修改成功");
                                this.open = false;
                                this.$emit('ok');
                            });
                        } else {
                            addAction(this.url.add, this.form).then(response => {
                                this.$modal.msgSuccess("新增成功");
                                this.open = false;
                                this.$emit('ok');
                            });
                        }
                    }
                });
            },
        }
    };
</script>
-->
